package com.example.fraud;

import com.example.client.FraudReviewResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1/fraud-check")
public record FraudReviewController(FraudReviewService fraudReviewService) {

    @GetMapping("{email}")
    public FraudReviewResponse isFraudster(@PathVariable("email") String customerEmail) {
        return new FraudReviewResponse(
                fraudReviewService.isFraudulentCustomer(customerEmail)
        );
    }
}